package com.phoenix;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

@SpringBootApplication
@EnableEurekaClient
@RestController
@EnableFeignClients
@EnableResourceServer
public class CloudDemoApiApplication {

    public static void main(String[] args) {
        SpringApplication.run(CloudDemoApiApplication.class, args);
    }


    @Autowired
    RemoteHelloService remoteHelloService;

    @RequestMapping("/t")
    public String test(Principal principal) {
        return remoteHelloService.remoteHello(principal.getName());
    }

}
